package com.tedu.API;

import org.junit.Test;

import java.util.Locale;

public class 作业 {
    @Test
    public void testLength(){
      //1.输出字符串"HelloJava"的字符串长度
        String str="HelloJava";
        System.out.println(str.length());

      //2.输出"HelloJava"中o的位置
        int index=str.lastIndexOf("o");
        System.out.println(index);

      //3.HelloJava"中下标为5处开始第一次出现以"o"的位置
        index=str.indexOf("o",5);
        System.out.println(index);

      //4.截取"HelloJava"中"Hello"并输出
        String url="HelloJava";
        url=url.substring(0,5);
        System.out.println(url);

      //5.截取"HelloJava"中"Java"并输出
        String urls="HelloJava";
        urls=urls.substring(5);
        System.out.println(urls);

      //6.将字符串" Hello "中两边的空白去掉后输出
        String s=" Hello ";
        s=s.trim();
        System.out.println(s);

      //7.输出"HelloJava"中第6个字符"J"
        String a="HelloJava";
        char c=a.charAt(5);
        System.out.println(c);

      //8.将"HelloJava"转换为小写
        String b="HelloJava";
        b=b.toLowerCase();
        System.out.println(b);

      //将"HelloJava"转换为大写
        String d="HelloJava";
        d=d.toUpperCase();
        System.out.println(d);
    }
}
